﻿function login() {
    var name = $('#username').val();
    var pass = $('#password').val();
    if (name == "" || pass == "") {
        alert("【账号】或【密码】不能为空!");
        return;
    }

    //登录请求
    $.post('proc/login.ashx', { uname: name, upass: pass }, function (data) { loginHome(data, name, pass, "0"); });
}

function loginHome(data, u, p, s) {
    if (data == "N")
        alert("账号或密码错误！");
    else if (data == "P")
        alert("账号已过期！");
    else if (data == "1") {
        $('#password').val("");
        //$.ui.loadContent('webhome', false, false, 'slide');
        //$("#puserinfo").html("当前登陆名：" + $('#username').val());
        
        if (document.getElementById("css3").checked) {
            SetCookie("savename", u, 7);
            SetCookie("savepass", p, 7);
        }
        else {
            deleteCookie("savename");
            deleteCookie("savepass");
        }

        location.href = "index.aspx";
    }
    else
        alert("未知错误，请确保网络畅通后登陆！");
}



